<?php 
	require_once("function/initialize.php");
	require_once("function/file.php");
	openConnection();
	if(isset($_REQUEST["logout"]))
		logout();
	if(!isLoggedIn())
		pageRedirect("login.php","");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Stock Management System</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/mainstyle.css" rel="stylesheet" type="text/css"  media="screen"/>
<link href="css/form.css" rel="stylesheet" type="text/css"  media="screen"/>
<link href="css/style_pagination.css" rel="stylesheet" type="text/css"  media="screen"/>
<script type="text/javascript" src="js/script.js"></script>
<!-------date time--------- -->
<script src="js/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery.date_input.js"></script>
<link rel="stylesheet" href="css/date_input.css" type="text/css">

<script type="text/javascript">$(function() {
   $("#from_sales_date").date_input();
   $("#to_sales_date").date_input();
   $("#from_purchase_date").date_input();
   $("#to_purchase_date").date_input();
   $("#from_sales_purchase_date").date_input();
   $("#to_sales_purchase_date").date_input();
   $("#from_stock_sales_date").date_input();
   $("#to_stock_sales_date").date_input();
   $("#date").date_input();	
   $("#lastupdate").date_input();
   $("#txtdateStock").date_input();
   $("#txtsaleDate").date_input();
    $("#txtDate").date_input();
   $("#txtExDate").date_input();
   $("#from_profit_date").date_input();
   $("#to_profit_date").date_input();
});
</script>
<!-- sort data -->
<style type="text/css" title="currentStyle">
			@import "css/demos.css";
		</style>
		<!--<script type="text/javascript" language="javascript" src="js/jquery.js"></script>-->
		<script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script>
		<script type="text/javascript" charset="utf-8">
			var oTable;
			
			$(document).ready(function() {
				/*$('#form').submit( function() {
					var sData = $('input', oTable.fnGetNodes()).serialize();
					alert( "The following data would have been submitted to the server: \n\n"+sData );
					return false;
				} );*/
				
				oTable = $('#example').dataTable();
			} );
		</script>
<!-- end sort data -->
<!--search value on key press-->
<script type='text/javascript' src='js/jquery.autocomplete.js'></script>
<link rel="stylesheet" type="text/css" href="css/jquery.autocomplete.css" />
<!--make dynamic form -->
<script type="text/javascript" src="js/jquery-dynamic-form.js"></script>
<script type="text/javascript">
	$(document).ready(function(){	
		$("#duplicate").dynamicForm("#plus", "#minus", {limit:50, createColor: 'yellow',removeColor: 'red'});
	});

	function balanceCalc()
	{		if(parseFloat($("#newpayment").val()) > parseFloat($("#balance").val()))
			$("#newpayment").val(parseFloat($("#balance").val()));
			
		
	}
</script>
<!--validation-->
 <link rel="stylesheet" type="text/css" href="css_validate/styles.css" />
    <!--<script type="text/javascript" src="js_validate/jquery.1.3.2.js"></script>-->
    <script type="text/javascript" src="js_validate/jquery.ufvalidator-1.0.4.js"></script>
	<script type="text/javascript">
		// EXECUTE PLUGIN ON DOM READY - START
		$(function () {

			$('#Submit').formValidator({
				scope		: '#form1',
				errorDiv	: '#errorDiv3'
			});
			
		});
		// EXECUTE PLUGIN ON DOM READY - END
	</script>
<!-- end validation-->

</head>

<body>
	<div class="header">
         <?php require_once('include_layout/header.php'); ?>
    </div><!--end header -->
    <div class="center" align="center">
        <div class="container" align="left">
             <div class="wrapper_right">
             	<div class="sidebar_right">
       				<?php 
						if(isset($_GET['action']) && $_GET['action'] != ''){
							if(file_exists($_GET['action'].".php")){
								//run page
								include($_GET['action'].".php");
								//show curent page
								$page=$_GET['page'].".php";
							}else{
								//run page
								require_once("home.php");
									$page=$_GET['page'].".php";
							}
						}else{
							 //show curent page
							 require_once("home.php");
							 $page="home.php";
						}
					?>
                </div>
             </div>
             <div class="sidebar_left">
             	<?php  require_once('include_layout/left.php'); ?>
             </div>
        </div><!--end container -->
    </div><!--end center -->
    <div class="footer">
    	<?php 
			require_once('include_layout/footer.php');
		?>
    </div><!--end footer -->
</body>
</html>
<?php
	closeConnection();
?>